# Maintainer: Oleg Titov <oleg.titov@gmail.com>

pkgname=iperf3
pkgver=3.7
pkgrel=1
pkgdesc='TCP, UDP, and SCTP network bandwidth measurement tool'
arch=('i686' 'x86_64')
url="https://github.com/esnet/iperf"
license=('BSD')
depends=('msys2-runtime' 'gcc-libs' 'openssl')
makedepends=('openssl-devel')
source=("http://downloads.es.net/pub/iperf/iperf-${pkgver}.tar.gz")
sha256sums=('d846040224317caf2f75c843d309a950a7db23f9b44b94688ccbe557d6d1710c')

build() {
  cd ${srcdir}/iperf-${pkgver}
  ./configure \
    --build=${CHOST} \
    --host=${CHOST} \
    --target=${CHOST} \
    --prefix=/usr \
    ac_cv_func_SetProcessAffinityMask=no

  make
}

check() {
  cd ${srcdir}/iperf-${pkgver}
  make check
}

package() {
  cd ${srcdir}/iperf-${pkgver}
  make DESTDIR=${pkgdir} install
  install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
  install -Dm 644 README.md -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 examples/*{.am,.in,.c} -t "${pkgdir}/usr/share/doc/${pkgname}/examples"
}
